package com.muyu.system.domain.model;

import com.muyu.common.core.web.model.QueryModel;
import com.muyu.system.domain.req.SysConfigListReq;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.util.Date;

/**
 * 参数配置 分页 模型
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class SysConfigPageQueryModel extends QueryModel<SysConfigPageQueryModel> {

    /**
     * 配置名称
     */
    private String configName;

    /**
     * 配置Key
     */
    private String configKey;

    /**
     * 配置类型
     */
    private String configType;

    /**
     * 开始时间
     */
    private Date beginTime;

    /**
     * 结束时间
     */
    private Date endTime;


    public static SysConfigPageQueryModel reqBuild(SysConfigListReq sysConfigListReq) {
        SysConfigPageQueryModel configPageQueryModel = SysConfigPageQueryModel.builder()
                .configName(sysConfigListReq.getConfigName())
                .configType(sysConfigListReq.getConfigType())
                .configKey(sysConfigListReq.getConfigKey())
                .beginTime(sysConfigListReq.getBeginTime())
                .endTime(sysConfigListReq.getEndTime())
                .build();
        configPageQueryModel.domainBuild(sysConfigListReq);
        return configPageQueryModel;
    }
}
